<template>
	<view>
		<!-- <view class="wrap">
			<u-swiper :list="list"></u-swiper>
		</view> -->
		<u-navbar :is-back="true" title="奖励大厅" :background="background" title-color="white" back-icon-color='white'
			style="position: relative;z-index: 3;">
		</u-navbar>
	
		<scroll-view scroll-x class="bg-mauve nav text-center" style="background-color: #f3f3f3;">
			<view class="flex text-center" style="display: flex;text-align: center;height: 80rpx;justify-content:space-around;">
				<view class="cu-item flex-sub" :class="index==TabCur?'text-yellow2 cur':'black'"
					v-for="(item,index) in cuIconList" :key="index" @tap="tabSelect" :data-id="index"
					:data-ids="item.id" style="width: 40%;line-height: 80rpx;text-align: center;">
					{{item.name}}
				</view>
			</view>
		</scroll-view>
		<!-- <view v-if="pageList[0].length==0"
			style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 10upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;text-align: center;">
			暂无数据
		</view> -->
		<view>
			<view v-if="TabCur==0" v-for="(item,index) in taskList" :key="index"
				style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 10upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;">

				<view style="display:flex;justify-content: space-around;">
					<view
						style="width: 70%;display: flex;justify-content: space-around;justify-items: center; height: 200upx;">
						<view style="width: 15%;display: flex;flex-direction: column;">
							<view style="flex: 1;"></view>
							<view style="flex: 2;">
								<image :src="item.img" style="width: 80upx;height: 80upx;"></image>
							</view>
							<view style="flex: 1;"></view>
						</view>
						<view style="display: flex;flex-direction: column;width: 80%;font-size: 30upx;">
							<view style="height: 35%;margin-top: 10upx;">{{item.title}}</view>
							<!-- <view style="height: 21%;color:gray">兑换所需:{{item.yk}}积分</view> -->
							<view style="height: 21%;color:gray">年利率:{{(item.liv*100).toFixed(2)}}%</view>
							<view style="height: 21%;color:gray">返利周期:{{item.day}}天</view>
						</view>
					</view>
					<view
						style="width: 26%;display: flex;flex-direction: column;text-align: center;align-items: center;">
						<view style="flex: 5;"></view>
						<view
							style="background-image: linear-gradient(to right, #f14b90, #f93c5c);flex: 5;font-size: 30upx;color: #ffffff;border-radius: 33upx;background-color: #eb6d33;padding: 20upx 0 0 0;text-align: center;width: 80%;line-height: 30upx;"
							@click="setTask(item.id)">购买</view>
						<view style="flex: 1;font-size: 1px;color:gray;font-size: 25upx;">已购买:{{item.num}}个</view>
						<view style="flex: 5;"></view>
					</view>
				</view>
			</view>
			<!-- 已购买的理财产品-->
			<view v-if="TabCur==1 && usersTaskList.length>0">
				<view
					style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 20upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;display: flex;justify-content: space-around;">
					<view style="flex: 1;"></view>
				<!-- 	<view style="flex: 3;display:flex;flex-direction: column;align-items: center;">
						<view style="flex: 2;color: #eb6d33;font-size: 30upx;">
							{{usersTaskList[0][0].tudou_reward?usersTaskList[0][0].tudou_reward:'0'}}
							{{data.sumrewardafter}}
						</view>
						<view style="font-size: 1upx;flex:1;font-size: 30upx;">剩余待返还</view>
					</view> -->
				<!-- 	<view style="flex: 3;display:flex;flex-direction: column;align-items: center;">
						<view style="color: #eb6d33;flex:3;font-size: 30upx;">
							{{usersTaskList[0][0].todayreward?usersTaskList[0][0].todayreward:'0'}}
							{{data.sumtodayreward}}
						</view>
						<view style="flex:1;font-size: 1upx;font-size: 30upx;">今日奖励返还</view>
					</view> -->
					<view style="flex: 1;"></view>
				</view>
				<view v-for="(item2,index2) in usersTaskList[0]" :key="index2"
					style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 10upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;">
					<view style="display:flex;justify-content: space-around;">
						
						
						<view
							style="width: 60%;display: flex;justify-content: space-around;justify-items: center; height: 200upx;">
							<view style="width: 15%;display: flex;flex-direction: column;">
								<view style="flex: 1;"></view>
								<view style="flex: 2;">
									<image :src="item2.img2|imgfilter" style="width: 80upx;height: 80upx;"></image>
								
								</view>
								<view style="flex: 1;"></view>
							</view>
							<view style="display: flex;flex-direction: column;width: 80%;font-size: 30upx;">
								<view style="height: 35%;margin-top: 10upx;">{{item2.title}}</view>
								<view style="height: 21%;color:gray">已返还:{{(item2.ppp*1).toFixed(2)}}利息</view>
								<view style="height: 21%;color:gray">待返还:{{(item2.pp*1).toFixed(2)}}利息</view>
								<view style="height: 21%;color:gray">购买时间:{{item2.createdate |datafilter}}</view>
							</view>
						</view>
						<view
							style="width: 36%;display: flex;flex-direction: column;text-align: center;align-items: center;">
							<view style="flex: 5;"></view>
							<view style="flex: 5;font-size: 30upx;padding: 15upx 0 0 0;text-align: center;width: 80%;">
								已返利({{item2.daynum}}天)</view>
							<view style="flex: 1;font-size: 1rpx;color:gray;font-size: 20upx;">
								(剩余时长:{{item2.day-item2.daynum}}天)</view>
							<view style="flex: 5;"></view>
						</view>
					</view>
				</view>
			</view>

			<!-- 已完成奖励 -->
			<!-- <view v-for="(item2,index2) in usersTaskList[1]" v-if="TabCur==2  && usersTaskList.length>0"
				style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 10upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;">
				<view style="display:flex;justify-content: space-around;">
					<view
						style="width: 60%;display: flex;justify-content: space-around;justify-items: center; height: 200upx;">
						<view style="width: 15%;display: flex;flex-direction: column;">
							<view style="flex: 1;"></view>
							<view style="flex: 2;">
								<image :src="item2.img2" style="width: 80upx;height: 80upx;"></image>
							</view>
							<view style="flex: 1;"></view>
						</view>
						<view style="display: flex;flex-direction: column;width: 80%;font-size: 30upx;">
							<view style="height: 35%;margin-top: 10upx;">{{item2.title}}</view>
							<view style="height: 21%;color:gray">已返还:{{item2.tudou}}土豆</view>
							<view style="height: 21%;color:gray">待返还:{{item2.tudou_reward}}土豆</view>
							<view style="height: 21%;color:gray">兑换时间:{{item2.updatedate | datafilter}}</view>
						</view>
					</view>
					<view
						style="width: 36%;display: flex;flex-direction: column;text-align: center;align-items: center;">
						<view style="flex: 5;"></view>
						<view style="flex: 5;font-size: 1px;padding: 15upx 0 0 0;text-align: center;width: 80%;">
							已完成({{item2.daynum}}天)</view>
						<view style="flex: 1;font-size: 1rpx;color:gray">(剩余时长:{{item2.day-item2.daynum}}天)</view>
						<view style="flex: 5;"></view>
					</view>
				</view>
			</view> -->
			<!-- 财富包 -->
			<view v-if="TabCur==2">
				<view
					style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 20upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;display: flex;justify-content: space-around;">
					<view style="flex: 1;"></view>
					<view style="flex: 3;display:flex;flex-direction: column;align-items: center;">
						<view style="flex: 2;color: #eb6d33;font-size: 30upx;">
							<!-- {{usersTaskList[0][0].tudou_reward?usersTaskList[0][0].tudou_reward:'0'}} -->
							{{usersTaskList[2][0]['count']||0}}
						</view>
						<view style="font-size: 1upx;flex:1;font-size: 30upx;">剩余待返还(活跃度)</view>
					</view>
					<view style="flex: 3;display:flex;flex-direction: column;align-items: center;">
						<view style="color: #eb6d33;flex:3;font-size: 30upx;">
							<!-- {{usersTaskList[0][0].todayreward?usersTaskList[0][0].todayreward:'0'}} -->
							{{usersTaskList[2][0]['todaysc']||0}}
						</view>
						<view style="flex:1;font-size: 1upx;font-size: 30upx;">今日奖励返还</view>
					</view>
					<view style="flex: 1;"></view>
				</view>
				<view  v-for="(item,index) in usersTaskList[2]" :key="index"
					style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 10upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;">
				
					
					<view style="display:flex;justify-content: space-around;">
						<view
							style="width: 70%;display: flex;justify-content: space-around;justify-items: center; height: 200upx;">
							<view style="width: 15%;display: flex;flex-direction: column;">
								<view style="flex: 1;"></view>
								<view style="flex: 2;">
									<image src="/static/img/icon_account.png" style="width: 80upx;height: 80upx;"></image>
								</view>
								<view style="flex: 1;"></view>
							</view>
							<view style="display: flex;flex-direction: column;width: 80%;font-size: 30upx;">
								<view style="height: 35%;margin-top: 10upx;">{{item.title}}</view>
								<view style="height: 21%;color:gray">兑换所需:{{item.yk}}</view>
								<view style="height: 21%;color:gray">奖励活跃度:{{item.sc}}</view>
								<view style="height: 21%;color:gray">奖励周期:{{item.day}}</view>
							</view>
						</view>
						<view
							style="width: 26%;text-align: center;align-items: center;">
							<view style="flex: 5;"></view>
							<view
								style="margin:40rpx  auto 10rpx;background-image: linear-gradient(to right, #888, #999);font-size: 30upx;color: #ffffff;border-radius: 30upx;background-color: #eb6d33;padding: 10upx 0;margtext-align: center;width: 80%;"
								v-if="userInfo.ispicker==2 && item.id==14">已领取</view>
							<view 
								style="margin:40rpx  auto 10rpx;background-image: linear-gradient(to right, #f14b90, #f93c5c);font-size: 30upx;color: #ffffff;border-radius: 30upx;background-color: #eb6d33;padding: 10upx 0;margtext-align: center;width: 80%;"
								@click="setTask(item.id)" v-else>兑换奖励</view>
								
								
							<view style="flex: 1;font-size: 1px;color:gray;font-size: 25upx;">已购买:{{item.num}}个</view>
							<view style="flex: 5;"></view>
						</view>
					</view>
				</view>
			</view>
			<!-- <u-empty text="暂无数据..." mode="list" v-if="usersTaskList[1][1].title=''"></u-empty> -->
			<!-- 奖励说明 -->
			<view v-if="TabCur==3"
				style="width: 98%;background-color: #ffffff;margin: 0 auto;padding: 10upx;border-radius: 10upx;border-bottom: gainsboro;margin-bottom: 2upx;text-align: center;">
				<!-- {{imgurl}} -->
				<rich-text :nodes="imgurl"></rich-text>
			</view>
		</view>

		<!-- </view> -->

		<!-- <view class="" v-for="item in taskList" style="margin-top: 40upx;">
			<view>
				<text>{{item.title}}</text> <button type="default" @click="setTask(item.id)">兑换任务</button>
			</view>
		</view> -->
		<!-- 免责说明弹窗 -->
		<u-modal v-model="show2" :title='title' :content="content" :mask-close-able="true" @confirm='confirm'></u-modal>
		<u-popup :show="show5" mode="center"  @close="close" @open="open" >
				<view style="position: relative;width: 550rpx; height: 100%;display: flex;flex-direction: column;background-color: #fff;">
					 <u-icon name="close-circle" color="#fff" size="52" style="z-index: 6;position: absolute;right: 20rpx;top:15rpx" @click="gonggao2"></u-icon>
					<view style="width: 100%; height: 90rpx;background-color: #f14b90;color: #fff;text-align: center;line-height: 90rpx;">请输入投资金额</view>
					<view style="height: 65%;padding: 40rpx 30rpx;display: flex;flex-direction: column;justify-content: space-around;">
						<view style="margin-bottom: 40rpx;text-align: center;">帐户可用投资额:{{userInfo.yk_static}}金豆</view>
						<view style="display: flex;">
							<view style="width:10%"></view>
							<view style="display: flex;">
								<view style="width: 80%;border-bottom: #888 1px solid;text-align: center;"><input type="number" placeholder="请输入投资金额" v-model="money" @blur="change"/></view>								
								<view>金豆</view>
							</view>
							
							<view style="width:10%"></view>
						</view>
						
					</view>
					<view style="width: 80%; height: 70rpx;background-color: #f14b90;color: #fff;text-align: center;line-height: 70rpx;margin: 20rpx auto;border-radius: 25rpx;" @click="subok">确认</view>
				</view>
		</u-popup>
	</view>
</template>

<script>
	import service from '../../service.js';
	export default {
		data() {
			return {
				flag: false,//loding按钮展示状态
				show: false,//观看五次任务成功弹窗
				name: '',
				money:'',
				taskid:'',
				show5:false,
				card: '',
				phone:'',
				show3: false,
				title: '免责说明',
				show2: false,//免责说明弹窗
				content: '视频广告内容由广告商提供。相关产品，服务将由第三方承担。趣淘用户在购买或使用广告推荐的产品，服务等造成的损失，趣淘对其概不负责，亦不承担任何法律责任。如有问题请咨询该广告商客服。您的使用行为将被视为对本声明全部内容的认可。',
				// list: [{
				// 		image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
				// 		title: '昨夜星辰昨夜风，画楼西畔桂堂东'
				// 	},
				// 	{
				// 		image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
				// 		title: '身无彩凤双飞翼，心有灵犀一点通'
				// 	},
				// 	{
				// 		image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
				// 		title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
				// 	}
				// ],

				background: {
					// background: linear-gradient(to right, #f14b90, #f93c5c),

					// 导航栏背景图
					// background: 'url(https://cdn.uviewui.com/uview/swiper/1.jpg) no-repeat',
					// 还可以设置背景图size属性
					// backgroundSize: 'cover',

					// 渐变色
					backgroundImage: 'linear-gradient(to right, #f14b90, #f93c5c)'
				},
				cuIconList: [{
						id: 0,
						name: '投资理财产品'
					},
					{
						id: 1,
						name: '已购买的理财产品'
					},
					// {
					// 	id: 2,
					// 	name: '财富包'
					// },
					// {
					// 	id: 3,
					// 	name: '奖励说明'
					// },
				],
				TabCur: 0,
				taskList: [], //兑换奖励
				usersTaskList: [], //0 进行中 1 已完成 2财富包
				data: {
					dayTaskNum: 0, //今日已完成
					sumtodayreward: 0, //今日奖励返还
					sumrewardafter: 0 //剩余待返还
				},
				pageList: '',
				imgurl: '',
				aixin: 0.00,
				//userInfo: {},
				isLogin: 0,
				sectionShow: false,
				websiteconfig: {},
				userInfo: {
					nickName: '18092192639',
					avatar: 'https://zhaopin-c.bj.bcebos.com/2022%E6%98%A5%E6%8B%9B%E5%AD%A3/baidupc-22chunzhao.png',
				},

			}
		},
		async onLoad() {
			this.load();
			
		
			// var result = (await this.$ajax.get('task/givescmohtml'));
			// this.usersTaskList = result.data.data
		},
		filters: {
			imgfilter(str) {
				return str.replace("https", "http")
			},
		},
		async onShow() {
			// var str1='610302200612022026';
			// var year=str1.substring(6,10);
			// var month=str1.substring(10,12);
			// var day=str1.substring(12,14);
			// var str=year+'-'+month+'-'+day+' 00:00:00'
			//  var timestamp = new Date(str).valueOf();
			// console.log(timestamp+">>>>>>");
			// var nowtime=new Date().valueOf();
			// if(nowtime-timestamp>60*31536000000 || nowtime-timestamp<18*31536000000){
			// 	this.$api.msg("暂无权注册")
			// }
			// if(checkLogin(false)){
			// 	this.loadUserInfo()
			// 	this.loadCount()
			// }
			// var result = (await this.$ajax.get('Websiteconfig/index.html'));
			// this.websiteconfig = result.data.data
			// console.log(this.websiteconfig);

			// var result = (await this.$ajax.get('money/getAixin.html'));
			// this.aixin = result.data.data
			// console.log(result);
			var result = (await this.$ajax.get('users/getUserInfo.html'));
			console.log(result);
			if (result.data.data.status == '-1') {
				uni.clearStorage();
			};
			this.userInfo = result.data.data;
			uni.setStorageSync("taskflag",this.userInfo.taskflag);
			if (service.isLogin()) {
				this.isLogin = 1;
			} else {
				this.isLogin = 0;
			}
			// let that=this;
			// let loginInfo = service.getUsers()
			// if (loginInfo && loginInfo.name) {
			// 	that.userName = loginInfo.name;
			// } else {
			// 	that.userName = '登录';
			// }
			if (this.userInfo.img == "") {
				this.userInfo.img = "/static/img/user.png"
			}
			//onsole.log(result);
		},
		// onReady() {
		// 	this.flag=1
		//     this.$refs.adRewardedVideo.load();
		// },
		filters: {
			datafilter(value) {
				var date = new Date(value * 1000);
				var year = date.getFullYear() + '-';

				var month = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';

				var day = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate());

				var hour = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';

				var minute = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';

				var second = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());

				var startDate = year + month + day;

				return startDate;

			},
		},
		methods: {
			toclose() {
				this.show = false
			},
			change(){
				console.log(this.money+"VVVVV")
				if(this.userInfo.yk_static-this.money<0){
					this.$api.msg("您的帐户金豆不足")
					this.money=0
					return false;
				}
			},
			async subok(){
				console.log(this.money+"VVVVV")
				if(this.money<=0){
					this.$api.msg("投资额不能为零");
					return false;
				}
				var result = (await this.$ajax.get('task/setTask.html?money='+this.money+'&tid='+this.taskid));
				this.$api.msg(result.data.msg);
				this.show5=false
				this.load()
			},
			gonggao2(){
				this.show5=false
			},
			subcancel() {
				this.show3 = false
			},
		
			async subshiming() {
				
				
				var str1=this.card+"";
				if (this.card == '' ||  this.name == '' || str1.length!=18) {
					this.$api.msg('请输入正确的姓名和身份证号');
					return false;
				}
				var year=str1.substring(6,10);
				var month=str1.substring(10,12);
				var day=str1.substring(12,14);
				var str=year+'-'+month+'-'+day+' 00:00:00'
				 var timestamp = new Date(str).valueOf();
				console.log(timestamp+">>>>>>");
				var nowtime=new Date().valueOf();
				if(nowtime-timestamp>70*31536000000 || nowtime-timestamp<18*31536000000){
					this.$api.msg("暂无权注册")
					return false;
				}
				
				var data = {
					card: this.card,
					name: this.name
				}
				uni.setStorageSync('userinfo', data);
				// var result = await this.$ajax.get('users/checkshiming.html',{data:data});
				var result = await this.$ajax.get('users/checkshiming.html?card=' + this.card + '&name=' + this.name);
				console.log(result, '>>>>>')
				if (result.data.code == 1) {
					console.log(result.data.msg);
					this.shiming();
					// this.subwxpay();
					// this.shiming();
					// this.test(this.card,this.name);
					this.show3 = false;
				} else {
					this.$api.msg(result.data.msg);
				}
			},
			async load() {
				var result = await this.$ajax.get('task/gettask.html');
				this.pageList = this.taskList = result.data.data.taskList;
				this.data = result.data.data;
				this.usersTaskList = result.data.data.usersTaskList;
				console.log(this.usersTaskList);
				console.log(result+'888889999');
			},
			onadload(e) {
				console.log('广告数据加载成功');
				let providerName = this.$refs.adRewardedVideo.getProvider();
				console.log('广告商名称::', providerName);
				
				// this.$refs.adRewardedVideo.show()
				this.flag=false
				uni.hideLoading();
			},
			async onadclose(e) {
				console.log('onadclose');
				const detail = e.detail
				this.flag = false
				uni.hideLoading();
				// 用户点击了【关闭广告】按钮
				if (detail && detail.isEnded) {
					// 正常播放结束
					console.log("onadclose" + detail.isEnded);
					var result = (await this.$ajax.get('task/setUserTaskLog.html'));
					var time=new Date().getTime();
					uni.setStorageSync('playtime', time);
					console.log('播放时间'+uni.getStorageSync('playtime'))
					console.log('去看广告', result);
					if (this.data.dayTaskNum == (this.data.num-1)) {
						this.show = true
					}else{
						// this.$refs.adRewardedVideo.load();
						this.$api.msg('完成次数'+(this.data.dayTaskNum+1)+'/'+this.data.num);
					};
					this.load();

				} else {
					// 播放中途退出
					console.log("onadclose " + detail.isEnded);
				}
			},

			onaderror(e) {
				// 广告加载失败
				this.$api.msg("广告加载失败，请稍后重试");
				console.log(e.detail);
				this.flag = flase;
				uni.hideLoading();
				// console.log("onaderror: ", e.detail);
				// this.load();
			},
			setTaskLog(e) {
				console.log(e);
				//广告播放成功记录
				// var result = (await this.$ajax.get('task/settasklog.html'));
			},
			async tosee() {
				var time2=new Date().getTime();
				var time1=uni.getStorageSync('playtime');
				console.log('观看时间'+time1);
				console.log('观看时间'+time2);
				if(time1!='' && time1!=null){
					
					// console.log(Math.ceil(5-(time2-time1)/60000))
					if(time2-time1<120000){
						this.$api.msg('请'+Math.ceil(2-(time2-time1)/60000)+'分钟后再看广告！')
						return false
					}
				}
				
				
				console.log('toosee');
				//判断是否有任务
				if (this.usersTaskList[0].length == 0) {
					this.$api.msg('兑换任务后再观看');
					return;
				}
				if (this.data.dayTaskNum == 0) {
					this.show2 = true; //免责说明弹窗
					return;
				}
				this.showLoading();
				// this.flag = true;
				this.$refs.adRewardedVideo.show();
				
				// var result = (await this.$ajax.get('task/setUserTaskLog.html'));
				// console.log('去看广告', result);
				// this.load();
			},
			confirm() {
				// this.flag = true;
				// this.showLoading();
				// this.$refs.adRewardedVideo.show();
				uni.setStorageSync('type',2);
				uni.switchTab({
					url:'/pages/index/faxian5?'
				})
			},
			// 去看视频
			 async tosee2(){
				 //判断是否有任务
				 
				 if (this.usersTaskList[0].length == 0&&this.usersTaskList[2][0]['count']==0) {
				 	this.$api.msg('兑换任务后再观看');
				 	return;
				 }
				 if (this.data.dayTaskNum == 0) {
				 	this.show2 = true; //免责说明弹窗
				 	return;
				 }else{
					 uni.setStorageSync('type',2);
					 uni.switchTab({
					 	url:'/pages/index/faxian5?'
					 })
				 }
				 // this.showLoading();
				
			 },
			// 奖励说明
			async toArticles() {

				var result = (await this.$ajax.get('Articles/getArticles.html?aid=44'));
				return result;
			},
			tabSelect(e) {
				this.pageList = [];
				console.log("88888888888", e.currentTarget.dataset.ids)
				this.TabCur = e.currentTarget.dataset.id;
				this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
				if (this.TabCur == 1) {
					this.pageList = this.usersTaskList;
					console.log(JSON.stringify(this.pageList[0]))
				} else if (this.TabCur == 0) {
					this.pageList = this.taskList;
					console.log(JSON.stringify(this.pageList))
				} else if (this.TabCur == 3) {



					var re = this.toArticles();
					re.then(i => {
						console.log(i, '55555555555555');
						this.imgurl = i.data.data
					})

				}


			},
			// 人脸核身前微信支付1.8元
			async subwxpay() {
				var data = {
					sendmsg: '人脸核身微信支付', //留言
					deliveryPrice: '0',
					type: '6'
				}
				var result = await this.$ajax.get('Weixinpay/beforeBuy.html', {
					data: data
				});
				var payment = result.data.data.msg;
				console.log(payment, '微信支付参数');
				/*#ifdef APP-PLUS*/
				uni.getProvider({
					service: 'payment',
					success: function(res) {
						if (!res.provider.includes('wxpay')) {
							uni.showModal({
								title: '无法使用微信支付',
								content: JSON.stringify(res),
								success: function(res) {
									if (res.confirm) {
										console.log('用户点击确定');
									} else if (res.cancel) {
										console.log('用户点击取消');
									}
								}
							});
							return;
						}
					},
					fail(err) {
						uni.showModal({
							title: '无法使用微信支付',
							content: JSON.stringify(res),
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
						return;
					}
				});
				/*#endif*/
				var orderInfo = {
					"appid": payment.appId, // 微信开放平台 - 应用 - AppId，注意和微信小程序、公众号 AppId 可能不一致
					"noncestr": payment.nonceStr, // 随机字符串
					"package": "Sign=WXPay", // 固定值
					"partnerid": payment.partnerid, // 微信支付商户号
					"prepayid": payment.package, // 统一下单订单号 
					"timestamp": payment.timeStamp, // 时间戳（单位：秒）
					"sign": payment.signType // 签名，这里用的 MD5 签名
				};
				uni.requestPayment({
					"provider": "wxpay",
					"orderInfo": orderInfo, //微信、支付宝订单数据
					success: (res) => {
						// that.$api.tips("感谢你的爱心捐赠");
						// that.$refs.dPopup.close()
						// 支付成功更改支付状态
						this.updatepay();
						// uni.showLoading({
						// 	title: '加载中'
						// })
							// 实名认证
						// this.test(this.card,this.name);
						this.shiming();
						// this.updateuser();
						// that.loaddata();

						// uni.navigateTo({
						// 	url:`/pages/order/order?state=0`
						// })

						//console.log('success:' + JSON.stringify(res));
					},
					fail: (err) => {
						console.log(orderInfo);
						uni.showModal({
							title: '支付失败',
							content: JSON.stringify(err),
							success: function(res) {
								console.log(err);
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});

					}
				});

			},
			//人脸核身
			// async test() {
			// 	uni.request({
			// 		url: 'https://app.tudouduanshiping.com/face.php',
			async test(card, name) {
				uni.request({
					url: 'https://app.tudouduanshiping.com/face2.php?card=' + card + '&name=' + name,
					method: 'GET',
					success: res => {
						console.log(res, '9999999999');
						uni.hideLoading();
						const face = uni.requireNativePlugin('AThree-Face');
						//调⽤startFace()⽅法
						face.startFace({
							// biztoken:"2A2AD8BD-DA71-4483-BD1D-519C17093ABA",
							biztoken: res.data.BizToken,
							userid: "UoduFPW7MC2lTJs"
						}, result => {
							const msg = JSON.stringify(result);
							// console.log('msg变量类型',msg);
							// console.log('result变量',result);
							if (result.errorcode == 0) {
								// alert('成功');
								console.log('认证成功')
								this.updateuser();
								// users/sethasauth.html
							} else {
								console.log('认证失败')
								this.$api.msg('人脸核身认证失败!')
								uni.redirectTo({
									url:'/pages/user/user'
								})
								// this.updateuser();
							}

						})
					},
					fail: (err) => {
						this.$api.msg('人脸核身加载失败!')
					}
				})
		
				// var result = (await this.$ajax.get('https://app.tudouduanshiping.com/face.php'));
				// console.log(result,'99999999999');
				//获取插件实例

			},
			
			//身份证 姓名 手机号实名认证
			async shiming(){
				var result = (await this.$ajax.get('users/shiming.html?backname='+this.name +'&card='+ this.card+'&mobile=' + this.phone));
				if(result.data.code==1){
					this.$api.msg(result.data.msg);
				}else{
					this.$api.msg("实名认证失败");
				}
				// console.log(JSON.stringify(result.data)+"MMMMMMMM")
				// if(result.data.code==-1){
				// 	this.$api.msg("实名认证失败");
				// }
			},
			// 实名认证后更新用户信息
			async updateuser() {
				// var result = (await this.$ajax.get('users/sethasauth.html'));
				var result = (await this.$ajax.get('users/sethasauth.html?name=' + this.name + '&card=' + this.card));
				console.log(result.data, '?????')
				if (result.data.code == 1) {
					this.$tip.toast('实名认证成功!');
				}
			},
			// 实名认证支付成功后更新支付信息
			async updatepay() {
				// var result = (await this.$ajax.get('users/sethasauth.html'));
				var result = (await this.$ajax.get('users/setIspay.html?'));
				// console.log(result.data, '?????')
				// if (result.data.code == 1) {
				// 	this.$tip.toast('支付成功!');
				// }
			},
			async setTask(e) {
				console.log(e+"MMMMMMMM");
				this.show5=true;
				this.taskid=e;
				//兑换任务
				// var result = (await this.$ajax.get('task/setTask.html?id=' + e));
				// console.log(result.data.code, '0000000000');

				// // var result2 = (await this.$ajax.get('https://app.tudouduanshiping.com/face.php'));

				// // console.log(result2,'99999999999');
				// if (result.data.code == 0) {
				// 	uni.showModal({
				// 		title: '提示',
				// 		content: result.data.msg,
				// 		cancelText: "取消", // 取消按钮的文字  
				// 		confirmText: "确认", // 确认按钮的文字  
				// 		showCancel: true, // 是否显示取消按钮，默认为 true
				// 		confirmColor: '#39B54A',
				// 		cancelColor: '#f55850',
				// 		success: (res) => {
				// 			if (res.confirm) {
				// 				console.log('comfirm') //点击确定之后执行的代码
				// 				// this.subwxpay();
				// 				// this.test();
				// 				var userinfo = uni.getStorageSync('userinfo');
				// 				if (userinfo != null && userinfo != '') {
				// 					this.name = userinfo.name
				// 					this.card = userinfo.card
				// 				}
				// 				this.show3 = true
							


				// 			} else {
				// 				console.log('cancel') //点击取消之后执行的代码
				// 			}
				// 		}
				// 	})

				// } else {
				// 	this.$api.msg(result.data.msg);
				// }
				// this.load();
			},
			showLoading(){
				uni.showLoading({
					title:'加载中'
				})
			}
		}
	}
</script>

<style>
	.black {
		color: black
	}

	.text-yellow .cur {
		color: #f14b90
	}
	.text-yellow2{
		color: #f14b90
	}
</style>
